struct TreeNode* g(int* nums, int left, int right)
{
    if (left > right)
    {
        return NULL;
    }
    int mid = (left + right) / 2;
    struct TreeNode* root = (struct TreeNode*)malloc(sizeof(struct TreeNode));
    root->val = nums[mid];
    root->left = g(nums, left, mid - 1);
    root->right = g(nums, mid + 1, right);
    return root;
}

struct TreeNode* sortedArrayToBST(int* nums, int numsSize) {
    return g(nums, 0, numsSize - 1);

}